package nth.randcats.server;

import java.util.Random;

import nth.randcats.client.RandomNumber;
import com.google.gwt.user.server.rpc.RemoteServiceServlet;

@SuppressWarnings("serial")
public class RandomNumberImpl extends RemoteServiceServlet implements RandomNumber {
	
	Random rand = new Random();
	
	@Override
	public int getRandomNumber(String netid, String password, int max) {
		final int combinedHash = (netid + password).hashCode();
		rand.setSeed(combinedHash);
		return rand.nextInt(max);
	}
}
